package com.ly.count.impl.login.transfer;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.login.param.CPlusLoginPage;
import com.ly.count.login.param.CPlusRegisterParam;
import com.ly.count.login.po.CPlusLogin;

import java.sql.Timestamp;

public class CPlusLoginTransfer {

    public static Page<CPlusLogin> toPage(CPlusLoginPage cPlusLoginPage) {
        Page<CPlusLogin> page = new Page<>();
        page.setTotal(cPlusLoginPage.getTotal());
        page.setCurrent(cPlusLoginPage.getCurrent());
        page.setSize(cPlusLoginPage.getSize());

        return page;
    }

    public static CPlusLogin toPO(CPlusRegisterParam cPlusRegisterParam) {
        if (cPlusRegisterParam == null) {
            return null;
        }
        CPlusLogin cPlusLogin = new CPlusLogin();
        cPlusLogin.setCreateTime(new Timestamp(System.currentTimeMillis()));
        cPlusLogin.setPassword(cPlusRegisterParam.getPassword());
        cPlusLogin.setCreator(0L);
        return cPlusLogin;
    }

}
